package cn.iocoder.yudao.module.trade.controller.app.giftcard.vo;

import cn.iocoder.yudao.module.trade.dal.dataobject.giftcard.GiftCardDO;
import cn.iocoder.yudao.module.trade.service.giftcard.GiftCardReceiveGiveService;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.util.Date;

@Schema(description = "用户 App - 礼品卡状态列表 Request VO")
@Data
public class AppGiftCardUseListVO {

    @Schema(description = "礼品卡id", example = "")
    private Long giftCardId;

    @Schema(description = "礼品卡名称")
    private String giftCardTitle;

    @Schema(description = "礼品卡 背景图片")
    private String giftCardPicUrl;

    @Schema(description = "礼品卡商品总价，单位：分")
    private Integer giftCardPrice;

    @Schema(description = "有效期开始时间")
    private Date validityStartTime;

    @Schema(description = "有效期结束时间")
    private Date validityEndTime;

    @Schema(description = "礼品卡状态 0:可使用 1:赠送中 2:已赠送 3:不可用")
    private Integer giftCardStatus;

    @Schema(description = "赠送时间")
    private Date receiveTime;

    @Schema(description = "领取时间")
    private Date giveTime;

    @Schema(description = "次数")
    private Long giveReceiveCount;

    private String blessing;

    public AppGiftCardUseListVO() {

    }

    public AppGiftCardUseListVO(GiftCardDO giftCardDO, Date giveTime, GiftCardReceiveGiveService giftCardReceiveGiveService) {
        this.giftCardId = giftCardDO.getId();
        this.giftCardTitle = giftCardDO.getGiftCardTitle();
        this.giftCardPicUrl = giftCardDO.getGiftCardPicUrl();
        this.giftCardPrice = giftCardDO.getGiftCardPrice();
        this.validityStartTime = giftCardDO.getValidityStartTime();
        this.validityEndTime = giftCardDO.getValidityEndTime();
        this.giftCardStatus = giftCardDO.getGiftCardStatus();
        this.giveTime = giveTime;
        this.giveReceiveCount = giftCardReceiveGiveService.countGiveReceiveByCardId(this.giftCardId);
        this.blessing = giftCardDO.getBlessings();
    }

}
